/*
 * testButton.h
 *
 *  Created on: Oct 1, 2011
 *      Author: nicoabie
 */

#ifndef TESTBUTTON_H_
#define TESTBUTTON_H_

#include "../src/common/utils/Logger.h"

#include "../src/SDLtoolkit/widgets/Button.h"

void testButton() {

	SDLEngine* engine = new SDLEngine("prueba boton",800,600,24);

	engine->start();

	Button* boton = new Button("Cerrar", "./trunk/res/img/button", engine->getMainSurface(), new Listener(), 200, 50);

	Event* eventoloco = new Event();

	bool quit = false;
	SDL_Event event;
	while (quit == false) {
		while (SDL_PollEvent(&event)) {
			eventoloco->setEvent(event);
			boton->handleEvent(*eventoloco);
			engine->refreshScreen();

			if (eventoloco->getType() == Quit) {
				quit = true;
			}
		}
	}

	engine->stop();

	Logger::log("Tests", "textbox", "Finalizado.");
}

#endif /* TESTBUTTON_H_ */
